<?php
include('common_include.php');

$prodCategory = $_GET['prodCategory'];
if ($prodCategory == "") {
	$prodCategory = "Winter Accessories";
}

$prodArr = array();
$dao = new SQLitePersistence();
$prodArr = $dao->getProductsByCategory($prodCategory, "", "");
unset($dao);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<title>Winning Marketing</title>
	<link href="style.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
<!--
.style5 {font-size: 16px}
.style6 {
	color: #FFFFFF;
	font-size: 16px;
	font-weight: bold;
}
-->
    </style>
<script>

popupWidth = 800;
popupHeight = 500;
posTopLeftX = (screen.width/2) - (popupWidth/2);
posTopLeftY = (screen.height/2) - (popupHeight/2);

function popupDetail(productCode) {
	popupSpec = "menubar=0,resizable=0,width="+popupWidth+",height="+popupHeight+",left="+posTopLeftX+",top="+posTopLeftY;
	window.open ("product_display.php?prodCode="+productCode,"ProductDetail",popupSpec);
}
</script>
</head>
<body>
<div id="container">
	<div id="main">
		<div id="header"><img src="images/template/skitemplate_03.gif" width="753" height="341" /></div>
		<div id="nav">
			<ul>
				<li><a href="index.php">About Us </a></li>
				<li><a href="product.php">Products</a></li>
				<li><a href="wholesale.html">Wholesale / Export</a></li>
				<li><a href="members.html">Members Area </a></li>
				<li><a href="contactUs.html">Enquiry / Contact us</a></li>
				<li><a href="Settlement.php">Shopping Cart</a></li>
			</ul>
		</div>
		<div id="content">
		  <div id="left">
		    <table width="160%" border="0" align="center" cellspacing="5">
              <tr>
                <td colspan="4"><span class="post style5">Our Products</span></td>
              </tr>
              <tr>
                <td><div align="left"><span class="post"><a href="product.php?prodCategory=Winter%20Accessories">Winter Accessories</a></span></div></td>
                <td><div align="left"><span class="post"><a href="product.php?prodCategory=Bags%20%26%20Luggage">Bags &amp; Luggage </a></span></div></td>
                <td><div align="left"><span class="post"><a href="product.php?prodCategory=Casual%20Wear">Casual Wear</a></span></div></td>
                <td><div align="left"><span class="post"><a href="product.php?prodCategory=Outdoor%20%26%20Camping%20Products">Outdoor &amp; Camping Products</a></span></div></td>
              </tr>
            </table>
		  </div>
		  <h1 class="post">&nbsp;</h1>
		  <div class="clear">
		    <p>&nbsp;</p>
		    <p align="center">&nbsp;</p>
		    <table width="85%" border="0" align="center" cellspacing="10">
              <tr valign="bottom">
                <td colspan="2" align="center" bgcolor="#245882"><div align="left">
                  <p>&nbsp;</p>
                  <p class="style6"><?php echo $prodCategory?></p>
                  <p>&nbsp;</p>
                </div></td>
              </tr>
			<?php for ($i=0; $i < sizeof($prodArr); $i++) {
				$rowIDAttr = $i;
				$aProduct = $prodArr[$i];

				list($width, $height, $type, $attr) = getimagesize($aProduct->getThumbnailPath());
				if ($width > 150 || $height > 250) {
					if ($width/150 > $height/250) {
						$height = (int) ($height / ($width/150));
						$width = 150;
					} else {
						$width = (int) ($width / ($height/150));
						$height = 250;
					}
				}
			?>
              <tr valign="middle">
                <td align="center" width="20%"><a href="javascript:popupDetail('<?php echo $aProduct->getProductCode();?>');"><img src="<?php echo $aProduct->getThumbnailPath();?>" border="0" width="<?php echo $width;?>" height="<?php echo $height;?>" /></a> </td>
                <td align="center" width="80%">
                	<table>
                		<tr>
                		<td width="20%" align="right"><b>Product Code:&nbsp;&nbsp;&nbsp;</b></td><td width="80%" align="left">
                		<a href="javascript:popupDetail('<?php echo $aProduct->getProductCode();?>');">
                		<?php echo $aProduct->getProductCode();?>
                		</a>
                		</td>
                		</tr>
                		<tr><td width="20%" align="right"><nobr><b>Product Name:&nbsp;&nbsp;&nbsp;</b></nobr></td><td width="80%" align="left">
                		<a href="javascript:popupDetail('<?php echo $aProduct->getProductCode();?>');">
                		<?php echo $aProduct->getProductName();?>
                		</a>
                		</td></tr>
                		<!-- tr><td width="20%" align="right" valign="top">Description:</td><td width="80%" align="left"><?php echo $aProduct->getDescription()?></td></tr-->
                		<tr><td width="20%" align="right"><b>Color Option:&nbsp;&nbsp;&nbsp;</b></td><td width="80%" align="left"><?php echo $aProduct->getColorOpt();?></td></tr>
                		<tr><td width="20%" align="right"><b>Size Option:&nbsp;&nbsp;&nbsp;</b></td><td width="80%" align="left"><?php echo $aProduct->getSizeOpt();?></td></tr>
                	</table>
                </td>
              </tr>
			<?php
				}
				unset($prodArr);
			?>
            </table>
		    <p>&nbsp;</p>
		    <p>&nbsp;</p>
		  </div>
	  </div>
	</div>
	<div id="footer">
		<ul>
			<li><a href="index.php">About Us | </a></li>
			<li><a href="product.php">Products | </a></li>
			<li><a href="wholesale.html">Wholesale / Export | </a></li>
			<li><a href="members.html">Members Area | </a></li>
			<li><a href="contactUs.html">Enquiry / Contact Us | </a></li>
			<li><a href="Settlement.php">Shopping Cart</a></li>
		</ul>
		<span>copyright of Winning Marketing</span>
	</div>
    <p>&nbsp;</p>
</div>
</body>
</html>